//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package common;

import init.StaticData;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;

import java.io.IOException;

public class Louncher {
	@Option(name = "-farmcount")
	public static Integer needcount;
	@Option(name = "-socksip")
	public static String socksip;
	@Option(name = "-socksport")
	public static String socksport;
	@Option(name = "-resourcesha")
	public static String resourcesha;
	public static FarmsWork fw = null;

	private static int DEFAULT_FARMS_VALUE = 10;

	public Louncher() {
	}

	public static void main(String[] args) {
		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
			public void run() {
				System.out.println("Application shutting down.");
				if (Louncher.fw != null) {
					Louncher.fw.saveProfiles();
				}

			}
		}));
		(new Louncher()).lounch(args);
	}

	private void lounch(String[] args) {
		CmdLineParser p = new CmdLineParser(this);

		try {
			p.parseArgument(args);
			if (needcount == null) {
				needcount = Integer.valueOf(DEFAULT_FARMS_VALUE);
			}

			StaticData.initResources();
			fw = new FarmsWork(needcount);
		} catch (CmdLineException var4) {
			var4.printStackTrace();
		} catch (IOException var5) {
			var5.printStackTrace();
		} catch (Exception var6) {
			var6.printStackTrace();
		}

	}
}
